﻿package
{
	public class Constants
	{		
		public static const BarType_MAGIC:int = 1;
		public static const BarType_HEALTH:int = 2;
		public static const BarType_ACTION:int = 3;
		public static const BarType_EXP:int = 4;
		public static const BarType_JP:int = 5;
		
		public static const Player1Name = "Roland";
		public static const Player2Name = StringHelper.Empty;
		public static const Player3Name = StringHelper.Empty;
		public static const Player4Name = StringHelper.Empty;
		public static const Player5Name = StringHelper.Empty;
		public static const Player6Name = StringHelper.Empty;
		public static const Player7Name = StringHelper.Empty;
		
		public static const NewlineCharacter = "^";
		public static const CommandSplitCharacter = "~";
		public static const PortraitSplitCharacter = "|";
		
		public static const Command_SaveGame = "Command_SaveGame";
		public static const Command_TreasureChest = "Command_TreasureChest";
		public static const Command_ContinuePlaying = "Command_ContinuePlaying";
		public static const Command_Rest = "Command_Rest";
		public static const Command_Quest = "Command_Quest";
		public static const Command_Movement = "Command_Movement";
		
		public static const RestDialogue = 0 + Constants.PortraitSplitCharacter + 
														"Would you like to rest?" + CommandSplitCharacter + Command_Rest;
		public static const SaveGameDialogue = 9 + Constants.PortraitSplitCharacter + 
														"Would you like to save your game?" + CommandSplitCharacter + Command_SaveGame;
		public static const SaveGameSucessDialouge = 9 + Constants.PortraitSplitCharacter + "Game saved!";
		public static const ContinuePlayingDialogue = 9 + Constants.PortraitSplitCharacter + 
														"Continue Playing?" + CommandSplitCharacter + Command_ContinuePlaying;
		public static const QuestDialogue = CommandSplitCharacter + Command_Quest;
		public static const MovementDialogue = CommandSplitCharacter + Command_Movement;
		
		public static const GameName:String = "AwesomeGame";
		
		public static const StartingBackground:String = "Village1";
		
		public static const NumPartyMembers:int = 7;
		public static const NumSaveFiles = 3;
		
		public static const MaxActionPoints:int = 100;
		public static const MaxExperiencePoints:int = 100;
		
		public static const GameSpeed:int = 1;
		public static const GameSpeedDivisor:int = 15;
		public static const AnimationLength = 30;
		
		public static const StageHeight:int = 400;
		public static const StageWidth:int = 550;
		
		public static const NewFileName = "[New Game]";
		
		public static const ButtonSplitName:String = "btn";
		public static const ButtonSplitError:String = "ERROR";
		public static const StringSplitName:String = "string";
		public static const MessageSplitCharacter = "_";
		
		public static const Keyboard_Z:int = 90;
		public static const Keyboard_X:int = 88;
		public static const Keyboard_C:int = 67;
		
		public static const Area_Village = "Malacosta Village";
		public static const Area_Beach = "Malacosta Beach";
		
		public static const AbilitiesPerJob = 5;
		
		public static function GetAllJobs():Array
		{
			return new Array
			(
			 	new Job_None(),
				new Job_Pirate(),
				new Job_Magician(),
				new Job_Criminal(),
				new Job_MMAFighter(),
				new Job_Nerd(),
				new Job_Fisherman(),
				new Job_Policeman(),
				new Job_Professor(),
				new Job_Doctor(),
				new Job_BetterMagician(),
				new Job_Arsonist(),
				new Job_Cowboy(),
				new Job_Millionaire(),
				new Job_SumoWrestler(),
				new Job_Firefighter(),
				new Job_Hunter(),
				new Job_Sage(),
				new Job_Sorceror(),
				new Job_Samurai(),
				new Job_Astronaut(),
				new Job_BestMagician(),
				new Job_Assassin()
			 )
		}
		
		public static function GetJobByJobId(jobId:int):Job
		{
			var allJobs:Array = GetAllJobs();
			for (var i:int = 0; i < allJobs.length; i++)
			{
				if (allJobs[i].JobId == jobId)
				{
					return allJobs[i];
				}
			}
			return null;
		}
		
		public static function GetPlayer1StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player1Name;
			tempBaseStats.FrameNum = 1;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			tempBaseStats.RHandEquip = new Equipment_Stick();
			
			return tempBaseStats;
		}
		
		public static function GetPlayer2StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player2Name;
			tempBaseStats.FrameNum = 2;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function GetPlayer3StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player3Name;
			tempBaseStats.FrameNum = 3;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function GetPlayer4StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player4Name;
			tempBaseStats.FrameNum = 4;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function GetPlayer5StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player5Name;
			tempBaseStats.FrameNum = 5;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function GetPlayer6StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player6Name;
			tempBaseStats.FrameNum = 6;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function GetPlayer7StartingStats():BaseStats
		{
			var tempBaseStats:BaseStats = new BaseStats();
			
			tempBaseStats.Name = Player7Name;
			tempBaseStats.FrameNum = 7;
			tempBaseStats.BaseMaxHealth = 10;
			tempBaseStats.Health = 10;
			tempBaseStats.BaseMaxMagic = 5;
			tempBaseStats.Magic = 5;
			tempBaseStats.BaseSpeed = 0;
			tempBaseStats.job = new Job_None();
			tempBaseStats.FrontRow = true;
			tempBaseStats.JP = 0;
			tempBaseStats.Experience = 0;
			tempBaseStats.BaseAttack = 5;
			tempBaseStats.BaseDefense = 0;
			tempBaseStats.BaseMagicPwr = 5;
			tempBaseStats.BaseMagicDef = 0;
			tempBaseStats.BaseAccuracy = 90;
			tempBaseStats.BaseEvasion = 0;
			tempBaseStats.BaseSpeed = 1;
			tempBaseStats.BaseLuck = 0;
			
			return tempBaseStats;
		}
		
		public static function Random(minNum:Number, maxNum:Number):int   
		{  
			return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);  
		} 
	}
}
